
#import "../typ/templates/settings.typ": *
#import "@preview/cetz:0.3.0": canvas, draw

== 一些应用

=== 几何

几何题目: 对任意一个凸四边形，以它的四边为边长向四边形的外部作正方形，并连接相对的边所得正方形的中心，所得到的两条线段等长且垂直.

#align(center, canvas(length: 1cm, {
  import draw: *

  // let rotate_point(angle, center, P) = {
  //   return (center.at(0)+(P.at(0)-center.at(0))*cos(angle)-(P.at(1)-center.at(1))*sin(angle), center.at(1)+(P.at(1)-center.at(1))*cos(angle)+(P.at(0)-center.at(0))*sin(angle))
  // }

  let (A, B, C, D) = ((0, 0), (1, 1.3), (3, 0.5), (1.2, -0.8))
  content(A, pad(right: .7em, text([$A$])), anchor: "east")
  content(B, pad(top: .7em, text([$B$])), anchor: "north")
  content(C, pad(left: .7em, text([$C$])), anchor: "west")
  content(D, pad(bottom: .7em, text([$D$])), anchor: "south")
  line(A, B, C, D, close: true)
  // line(A, B, name: "line-ab")
  // line(B, C, name: "line-bc")
  // line(C, D, name: "line-dc")
  // line(D, A, name: "line-da")

  // A1-A=i(B-A)
  let A1 = ((A.at(0)-B.at(1)+A.at(1)), (A.at(1)+B.at(0)-A.at(0)))
  // B2-B=-i(A-B)
  let B2 = ((B.at(0)+A.at(1)-B.at(1)), (B.at(1)-A.at(0)+B.at(0)))
  line(fill: gray.lighten(50%), A, A1, B2, B)
  // B1-B=i(C-B)
  let B1 = ((B.at(0)-C.at(1)+B.at(1)), (B.at(1)+C.at(0)-B.at(0)))
  // C2-C=-i(B-C)
  let C2 = (C.at(0)+B.at(1)-C.at(1), C.at(1)-B.at(0)+C.at(0))
  line(fill: gray.lighten(50%), B, B1, C2, C)  
  let C1 = ((C.at(0)-D.at(1)+C.at(1)), (C.at(1)+D.at(0)-C.at(0)))
  let D2 = ((D.at(0)+C.at(1)-D.at(1)), (D.at(1)-C.at(0)+D.at(0)))
  line(fill: gray.lighten(50%), C, C1, D2, D)
  let D1 =  ((D.at(0)-A.at(1)+D.at(1)), (D.at(1)+A.at(0)-D.at(0)))
  let A2 = (A.at(0)+D.at(1)-A.at(1), A.at(1)-D.at(0)+A.at(0))
  line(fill: gray.lighten(50%), D, D1, A2, A)

  let M1 = ((A.at(0)+B2.at(0))/2, (A.at(1)+B2.at(1))/2)
  content(M1, [$M_1$], anchor: "east")
  let M2 = ((B.at(0)+C2.at(0))/2, (B.at(1)+C2.at(1))/2)
  content(M2, [$M_2$], anchor: "south-west")
  let M3 = ((C.at(0)+D2.at(0))/2, (C.at(1)+D2.at(1))/2)
  content(M3, [$M_3$], anchor: "north")
  let M4 = ((D.at(0)+A2.at(0))/2, (D.at(1)+A2.at(1))/2)
  content(M4, [$M_4$], anchor: "north-east")
  line(M1, M3)
  line(M2, M4)
}))

这问题的证明依赖于另一个基本事实: 以任意三角形的两边向形外作正方形, 则此二正方形之中心分别与三角形第三边中点连线所得两线段垂直且等长. 它的证明只需要通过证实图中的两个三角形 $triangle.stroked.t M_1P D$ 和 $triangle.stroked.t M_2Q D$ 全等即可以实现($P$ 与 $Q$ 是所在边的中点).

#align(center, canvas(length: 1cm, {
  import draw: *

  // let rotate_point(angle, center, P) = {
  //   return (center.at(0)+(P.at(0)-center.at(0))*cos(angle)-(P.at(1)-center.at(1))*sin(angle), center.at(1)+(P.at(1)-center.at(1))*cos(angle)+(P.at(0)-center.at(0))*sin(angle))
  // }

  let (A, B, C) = ((0, 0), (1, 2), (3, 0))
  let D = ((A.at(0)+C.at(0))/2, (A.at(1)+C.at(1))/2)
  content(A, pad(right: .7em, text([$A$])), anchor: "east")
  content(B, pad(top: .7em, text([$B$])), anchor: "north")
  content(C, pad(left: .7em, text([$C$])), anchor: "west")
  content(D, pad(top: .7em, text([$D$])), anchor: "north")
  line(A, B, C, close: true)

  // A1-A=i(B-A)
  let A1 = ((A.at(0)-B.at(1)+A.at(1)), (A.at(1)+B.at(0)-A.at(0)))
  // B2-B=-i(A-B)
  let B2 = ((B.at(0)+A.at(1)-B.at(1)), (B.at(1)-A.at(0)+B.at(0)))
  line(fill: gray.lighten(50%), A, A1, B2, B)
  // B1-B=i(C-B)
  let B1 = ((B.at(0)-C.at(1)+B.at(1)), (B.at(1)+C.at(0)-B.at(0)))
  // C2-C=-i(B-C)
  let C2 = (C.at(0)+B.at(1)-C.at(1), C.at(1)-B.at(0)+C.at(0))
  line(fill: gray.lighten(50%), B, B1, C2, C)  

  let M1 = ((A.at(0)+B2.at(0))/2, (A.at(1)+B2.at(1))/2)
  content(M1, [$M_1$], anchor: "east")
  let M2 = ((B.at(0)+C2.at(0))/2, (B.at(1)+C2.at(1))/2)
  content(M2, [$M_2$], anchor: "south-west")
  line(M1, D, M2)

  // 辅助线
  let P = ((A.at(0)+B.at(0))/2, (A.at(1)+B.at(1))/2)
  let Q = ((B.at(0)+C.at(0))/2, (B.at(1)+C.at(1))/2)
  content(P, pad(left: .5em, text([$P$])), anchor: "south-west")
  content(Q, pad(right: .7em, text([$Q$])), anchor: "south-east")
  line(stroke: (dash: "dashed"), M1, P, D)
  line(stroke: (dash: "dashed"), M2, Q, D)
}))

现在借用复数来解决这个几何问题,利用各点字母同时指代其对应复数，那么只需要证明
$ M_1 - M_3 = ii(M_2 - M_4) $
就可以了.

根据几何关系有
$
 M_1 & = & frac(A+B,2)+ii frac(B-A,2) \
M_2 & = & frac(B+C,2) + ii frac(C-B, 2) \
M_3 & = & frac(C+D, 2) + ii frac(D-C, 2) \
M_4 & = & frac(D+A, 2) + ii frac(A-D, 2)
$
根据简单的计算便知要证明的等式是成立的. 这比几何方法要简单得多.


